﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RM.Common;
using System.Data;
namespace RM.BLL
{
    /// <summary>
    /// 导航菜单
    /// </summary>
    public partial class menu_list
    {
        private readonly DAL.menu_list dal;
        public menu_list()
        {
            dal = new DAL.menu_list();
        }

        #region Method

        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        public bool Exists(string title)
        {
            return dal.Exists(title);
        }
        public Model.menu_list GetModel(int id)
        {
            return dal.GetModel(id);
        }
        public Model.menu_list GetModel(string title)
        {
            return dal.GetModel(title);
        }
        public DataTable GetList(int parent_id)
        {
            return dal.GetList(parent_id);
        }
        #endregion

        #region ==========扩展方法==========
        /// <summary>
        /// 根据菜单的名称查询其ID
        /// </summary>        
        public int GetMenuId(string title)
        {
            return dal.GetMenuId(title);
        }
        /// <summary>
        /// 取得父ID下的菜单列表
        /// </summary>
        /// <param name="parent_id">父ID</param>
        /// <returns>DataTable</returns>
        public DataTable GetChildList(int parent_id)
        {
            return dal.GetChildList(parent_id);
        }
        /// <summary>
        /// 取得所有菜单列表（没有排序好，只有数据）
        /// </summary>
        /// <returns></returns>
        public DataTable GetDataList()
        {
            return dal.GetDataList();
        }
        #endregion
    }
}
